import Phaser from "phaser";
import BootScene from "@/scenes/BootScene";
import PreloadScene from "@/scenes/PreloadScene";
import MainScene from "@/scenes/MainScene";
import GameScene from "@/scenes/GameScene";
import { createApp } from "vue";
import { createPinia } from "pinia";
// 初始化Pinia
createApp({}).use(createPinia());

const config: Phaser.Types.Core.GameConfig = {
  type: Phaser.AUTO,
  parent: "game-container",
  backgroundColor: "#242424",
  scale: {
    mode: Phaser.Scale.FIT,
    autoCenter: Phaser.Scale.CENTER_BOTH,
    width: 1280,
    height: 720,
  },
  physics: {
    // default: "arcade",
    // arcade: {
    //   gravity: { x: 0, y: 200 },
    //   debug: true,
    // },
    default: "matter",
    // matter: {
    //   debug: true,
    //   // enableSleeping: false, // 禁用休眠保证持续物理模拟
    // },
    matter: {
      gravity: {
        y: 0.8,
      },
      enableSleep: true,
      debug: true,
    },
  },
  scene: [BootScene, PreloadScene, MainScene, GameScene],
};

new Phaser.Game(config);
